//
//  TaskAlertTableViewCell.m
//  HAODE
//
//  Created by LiYinDi on 15/12/30.
//  Copyright © 2015年 reabam.com. All rights reserved.
//

#import "TaskAlertTableViewCell.h"

@implementation TaskAlertTableViewCell
#define cellHightColor [UIColor colorWithRed:153.0f/255.0f green:153.0f/255.0f blue:153.0f/255.0f alpha:1.0]
#define cellNormalColor [UIColor colorWithRed:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0]

- (void)awakeFromNib {
  //  _dotLabel.layer.borderWidth= 0.5f;
    _dotLabel.layer.cornerRadius=5;
    _dotLabel.layer.masksToBounds = YES;
    [self setAutoLayout];
}
-(void)setModel:(TaskAlertModel *)model
{
    _numLabel.text= [NSString stringWithFormat:@"%@",  model.taskTypeName];
    _memberNameTag.text=model.taskIntro;
    _memberNameTag.numberOfLines=2;
    _timeLabel.text=[NSString stringWithFormat:@"%@",model.createDate];
    _timeLabel.textAlignment=NSTextAlignmentRight;
    
        if ([model.status isEqualToString:@"Y"]) {
            
            [_numLabel setTextColor:zhonghuiColor];
            [_timeLabel setTextColor:zhonghuiColor];
            [_memberNameTag setTextColor:zhonghuiColor];
            if ([model.taskType isEqualToString:@"DOrder_NA"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"dingdanshouli_normal"];
            }else if ([model.taskType isEqualToString:@"DOrder_ND"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"dingdanpeisong_normal"];
                
            }else if ([model.taskType isEqualToString:@"DBookingOrder_NA"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"yuyueshouli_normal"];
                
            }else if ([model.taskType isEqualToString:@"DNeedOrder_Results"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"yaohuoshouli_normal"];
                
            }else if ([model.taskType isEqualToString:@"DAllotOrder_NA"]||[model.taskType isEqualToString:@"DAllotOrder_Results"]||[model.taskType isEqualToString:@"DAllotOrder_YO"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"diaoboshouli_normal"];
                
            }else if ([model.taskType isEqualToString:@"DGoodsInOrder_YO"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"jinhuoshouhuo_normal"];
                
            }else if ([model.taskType isEqualToString:@"DCheckVouch_NP"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"pandianrenwu_normal"];
                
            }
         }
        else
        {
            
            [_numLabel setTextColor:qianheiColor];
            [_timeLabel setTextColor:shenhuiColor];
            [_memberNameTag setTextColor:shenhuiColor];
            if ([model.taskType isEqualToString:@"DOrder_NA"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"dingdanshouli_hight"];
            }else if ([model.taskType isEqualToString:@"DOrder_ND"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"dingdanpeisong_hight"];

            }else if ([model.taskType isEqualToString:@"DBookingOrder_NA"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"yuyueshouli_hight"];

            }else if ([model.taskType isEqualToString:@"DNeedOrder_Results"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"yaohuoshouli_hight"];

            }else if ([model.taskType isEqualToString:@"DAllotOrder_NA"]||[model.taskType isEqualToString:@"DAllotOrder_Results"]||[model.taskType isEqualToString:@"DAllotOrder_YO"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"diaoboshouli_hight"];

            }else if ([model.taskType isEqualToString:@"DGoodsInOrder_YO"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"jinhuoshouhuo_hight"];
 
            }else if ([model.taskType isEqualToString:@"DCheckVouch_NP"]) {
                _taskTypeImage.image=[UIImage imageNamed:@"pandianrenwu_hight"];
 
            }

        }
   
//    DOrder_NA 订单受理
//    DOrder_ND 订单配送
//    BookingOrder_NA 预约受理
//    DNeedOrder_NDNeedOrder_C 要货受理结果
//    DAllotOrder_NA 调拨受理
//    DAllotOrder_YA/DAllotOrder_YR调拨受理结果
//    DAllotOrder_YO 调拨收货
//    DWhsInItem_YO 进货收货
//    DCheckVouch_NP 盘点任务
    
    _lineLabel.backgroundColor=zuiqianhuiColor;
    _lineLabel.layer.borderColor = qianhuiColor.CGColor;
    [_lineLabel.layer setBorderWidth:0.40];   //边

}
-(void)setAutoLayout
{
    [_taskTypeImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15);
        make.width.equalTo(@25);
        
        make.height.equalTo(@25);
        
        make.top.equalTo(self.mas_top).with.offset(17.5);
    }];
    [_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_taskTypeImage.mas_right).with.offset(10);
      //  make.right.equalTo(self.mas_right);
        
        make.height.equalTo(@18);
        
        make.centerY.equalTo(_taskTypeImage.mas_centerY);
    }];
    [_memberNameTag mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(self.mas_left).with.offset(15);
        make.right.equalTo(self.mas_right).with.offset(-40) ;
        make.height.equalTo(@35);
        
        make.top.equalTo(_numLabel.mas_bottom).with.offset(13);
    }];
    [_btnImage mas_makeConstraints:^(MASConstraintMaker *make) {
    
        make.right.equalTo(self.mas_right).with.offset(-10) ;
        make.height.equalTo(@30);
        make.width.equalTo(@30);
        make.centerY.equalTo(_memberNameTag.mas_centerY);
    }];
       [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_numLabel.mas_right).with.offset(2);
        make.right.equalTo(self.mas_right).with.offset(-10) ;
        
        make.height.equalTo(@15);
        
        make.centerY.equalTo(_numLabel.mas_centerY);
    }];
    
    
    [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(0);
        make.right.equalTo(self.mas_right).with.offset(0) ;
        
        make.height.equalTo(@10);
        
         make.top.equalTo(self.mas_top).with.offset(100);
    }];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
